import React from "react";
import "../../i18n/config";
import { useTranslation } from "react-i18next";
function Index() {
  const { t, i18n } = useTranslation();
  const changeLang = () => {
    i18n.changeLanguage(i18n.language === "zh" ? "en" : "zh");
  };
  return (
    <div>
      <h1>{t("name")}</h1>
      <h1>{t("age")}</h1>
      <button onClick={changeLang}>
        {i18n.language === "zh" ? "英文" : "中文"}
      </button>
    </div>
  );
}

export default Index;
